package tom.jiafei;
import java.sql.*;
public class BookInf{
	String  bno;
	String[] bookInf={"2","2","3","4","5","6"};
	public void setBno(String i){
		bno=i;
	}
	public String getBno(){
		return bno;
	}
	public void setBookInf(){
	
		Connection con;
	    Statement sql;
	    ResultSet rs;
	    try{
	    	Class.forName("com.mysql.jdbc.Driver");
	    	}
	    catch(Exception e){}
   
    try{
		String uri = "jdbc:mysql://127.0.0.1:3306/book_store?useUnicode=true&characterEncoding=utf8";
		String user = "root";
		String password = "1e916d4e2405be9e";
		con=DriverManager.getConnection(uri,user,password);
		sql=con.createStatement();
		rs=sql.executeQuery("SELECT * from book where bno="+"'"+bno+"'");
		if(rs.next()){
			for(int i=0;i<6;i++){
				bookInf[i]=rs.getString(i+1);
			}			
		}
		con.close();
	}
	catch(SQLException e1){bookInf[0]="44";}
	}
	public String[] getBookInf(){
		return bookInf;
	}
}